/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.kz.shange.models;

import com.htkj.vdr.common.utils.MyDate;
import java.util.Date;
import java.util.List;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 *
 * @author Administrator
 */
@Document(collection = "Article")
public class Article {

    @DBRef
    Author author;
    Date atTime;
    String text;
    String resource;
    @Transient
    String atTimeStr;
    //    List<Discuse> discuses;
    //    @DBRef
    //    List<Author> attention;
    //    @Transient
    //    int attentionCount;
    //    @Transient
    //    int discusesCount;
    //<editor-fold defaultstate="collapsed" desc="property">

    public Author getAuthor() {
        return author;
    }

    public void setAuthor(Author author) {
        this.author = author;
    }

    public Date getAtTime() {
        return atTime;
    }

    public void setAtTime(Date atTime) {
        this.atTime = atTime;
    }

    public String getAtTimeStr() {
        
        String dt=MyDate.formatDate(new Date(), "yyyy-MM-dd");
        atTimeStr=MyDate.formatDate(atTime, "yyyy-MM-dd");
        atTimeStr=dt.equals(atTimeStr)?MyDate.formatDate(atTime, "今天 HH:mm:ss"):atTimeStr;        
        return atTimeStr;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getResource() {
        return resource;
    }

    public void setResource(String resource) {
        this.resource = resource;
    }


//</editor-fold>
}
